{% extends "bootstrap/base.html" %}

{% block title %}Flask 练习{% endblock %}

{% block head %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
{% endblock %}

{% block navbar %}
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
    <a class="navbar-brand" href="/">Flask 练习</a>
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
        <ul class="navbar-nav">
            <li><a class="nav-link" href="/">主页</a></li>
        </ul>
    </div>
    <ul class="navbar-nav">
        {% if current_user.is_authenticated %}
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-toggle="dropdown">帐户管理</a>
            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                <li class="dropdown-item"><a href="{{ url_for('auth.change_password') }}">修改密码</a></li>
                <li class="dropdown-item"><a href="{{ url_for('auth.change_email_request') }}">修改邮箱</a></li>
                <li class="dropdown-item"><a href="{{ url_for('auth.logout') }}">注销</a></li>
            </ul>
        </li>
        {% else %}
        <li><a class="nav-link" href="{{ url_for('auth.login') }}">登录</a></li>
        {% endif %}
    </ul>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup">
        <span class="navbar-toggler-icon"></span>
    </button>
</nav>
{% endblock %}

{% block content %}
<div class="container">
    {% for message in get_flashed_messages() %}
    <div class="alert alert-warning">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        {{ message }}
    </div>
    {% endfor %}

    {% block page_content %}{% endblock %}
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{{ moment.locale("zh-cn") }}
{% endblock %}